import delimited "scaling.csv", encoding(ISO-8859-1) clear
save "temp.dta", replace


use "AfricaChinaDS_FINAL.dta", clear


rename ISO country
move country ccode
sort country year

duplicates drop country year, force

merge 1:1 country year using temp

encode country, generate(count)

save "est_file.dta", replace

xtset count year



*** TABLE 1 (MAIN RESULTS)


** Model 1 - Analysis of China Trade Share on Preferences (speeches - wordscore) ***


xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1, fe vce(cluster count)

est store Model1


** Model 2 - Anaylsis of China Trade Share on Voting on All (Yes/No/Abstain) **

 xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

 est store Model2

 
** Model 3 - Anaylsis of China Trade Share on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Model3

 
** Model 4 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with China) (Yes/No/Abstain) **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Model4



estout Model1 Model2 Model3 Model4, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f))) style(tex)  legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)



*** TABLE 2 (IN ADDITIONAL TESTS)


** Model 5 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count) 


est store Model5


** Model 6 - Anaylsis of China Trade Share on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count) 


est store Model6


estout Model5 Model6, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)




*** TABLE 3 (IN ADDITIONAL TESTS - FOR COUNTRIES NOT RECOGNISING PRC) ***


** Model 7 - Analysis of China Trade Share on Preferences (speeches - wordscore) ***


xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if PRCdipreg==0, fe vce(cluster count)

est store Model7



** Model 8 - Anaylsis of China Trade Share on Voting on All (Yes/No/Abstain) **

xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if PRCdipreg==0&e(sample)==1, fe vce(cluster count)
 
 est store Model8

 
** Model 9 - Anaylsis of China Trade Share on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if PRCdipreg==0&e(sample)==1, fe vce(cluster count)

est store Model9

 
** Model 10 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with China) (Yes/No/Abstain) **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if PRCdipreg==0&e(sample)==1, fe vce(cluster count) 

est store Model10


** Model 11 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if PRCdipreg==0&e(sample)==1, fe vce(cluster count) 

est store Model11


** Model 12 - Anaylsis of China Trade Share on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if PRCdipreg==0&e(sample)==1, fe vce(cluster count) 


est store Model12


estout Model7 Model8 Model9 Model10 Model11 Model12, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)








*** ADDITIONAL ROBUSTNESS TESTS (IN SUPPLEMENTARY MATERIAL) ***




**** TABLE 1 - LAGGED TRADE MODELS ****

** Model 1 - Analysis of China Trade Share on Preferences (speeches - wordscore) ***

xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn  l.chn_tradeshare l.usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1, fe vce(cluster count)

est store Models1


** Model 2 - Anaylsis of China Trade Share on Voting on All (Yes/No/Abstain) **

 xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn l.chn_tradeshare l.usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)
 
 est store Models2
 
 
** Model 3 - Anaylsis of China Trade Share on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn l.chn_tradeshare l.usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models3

 
** Model 4 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with China) (Yes/No/Abstain) **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn l.chn_tradeshare l.usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Models4


** Model 5 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn l.chn_tradeshare l.usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Models5


** Model 6 - Anaylsis of China Trade Share on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn l.chn_tradeshare l.usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Models6

estout Models1 Models2 Models3 Models4 Models5 Models6, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)





*** TABLE 2 (IMPORTS FROM CHINA ANALYSIS) ***

** Model 7 - Analysis of Imports from China on Preferences (speeches - wordscore) **


xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn ImportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1, fe vce(cluster count)

est store Models7



** Model 8 - Anaylsis of Imports from China on Voting on All (Yes/No/Abstain) **

xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn ImportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models8


** Model 9 - Anaylsis of Imports from China on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn ImportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models9


** Model 10 - Anaylsis of Imports from China on Voting where China and US differ (similarity with China) (Yes/No/Abstain)  **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn ImportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models10



** Model 11 - Anaylsis of Imports from China on Voting where China and US differ (similarity with USA) (Yes/No/Abstain)  **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn ImportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models11


** Model 12 - Anaylsis of Imports from China on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn ImportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models12

estout Models7 Models8 Models9 Models10 Models11 Models12, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)





*** TABLE 3 (EXPORTS FROM CHINA ANALYSIS) ***

** Model 13 - Analysis of Exports to China on Preferences (speeches - wordscore) **


xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn ExportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1, fe vce(cluster count)

est store Models13



** Model 14 - Anaylsis of Exports to China on Voting on All (Yes/No/Abstain) **

xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn ExportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models14


** Model 15 - Anaylsis of Exports to China on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn ExportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models15


** Model 16 - Anaylsis of Exports to China on Voting where China and US differ (similarity with China) (Yes/No/Abstain) **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn ExportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models16


** Model 17 - Anaylsis of Exports to China on Voting where China and US differ (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn ExportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models17


** Model 18 - Anaylsis of Imports from China on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn ExportsChina_shareTT usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models18


estout Models13 Models14 Models15 Models16 Models17 Models18, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)




*** TABLE 4 (ADDITION CONTROL VARIABLES) ****


** Model 19 - Analysis of China Trade Share on Preferences (speeches - wordscore) ***


xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept  if Africa==1, fe vce(cluster count)

est store Models19




** Model 20 - Anaylsis of China Trade Share on Voting on All (Yes/No/Abstain) **

 xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept  if Africa==1&e(sample)==1, fe vce(cluster count)
 
 est store Models20
 
 
** Model 21 - Anaylsis of China Trade Share on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept  if Africa==1&e(sample)==1, fe vce(cluster count)

est store Models21

 
** Model 22 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with China) (Yes/No/Abstain) **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept  if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Models22


** Model 23 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept  if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Models23


** Model 24 - Anaylsis of China Trade Share on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept if Africa==1&e(sample)==1, fe vce(cluster count) 

est store Models24

*wordscore_l_n wordscore_l_mv

estout Models19 Models20 Models21 Models22 Models23 Models24, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)





***** TABLE 5 - CUBIC SPLINES ANALYSIS ******


mkspline yearsp = year, cubic knot(1990, 2000) displayknots


** Model 25 - Analysis of China Trade Share on Preferences (speeches - wordscore) ***


xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP totnatresource_gdp yearsp* if Africa==1, fe vce(cluster count)

est store Models25



** Model 26 - Anaylsis of China Trade Share on Voting on All (Yes/No/Abstain) **

xtreg prop_vote3 polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP totnatresource_gdp yearsp* if Africa==1, fe vce(cluster count)

est store Models26

 
** Model 27 - Anaylsis of China Trade Share on Voting on HR (Yes/No/Abstain) **

xtreg prop_vote7 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP totnatresource_gdp yearsp* if Africa==1, fe vce(cluster count)

est store Models27

 
** Model 28 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with China) (Yes/No/Abstain) **

xtreg prop_vote2 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP totnatresource_gdp yearsp* if Africa==1, fe vce(cluster count) 

est store Models28


** Model 29 - Anaylsis of China Trade Share on Voting where China and US differ (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote10 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP totnatresource_gdp yearsp* if Africa==1, fe vce(cluster count) 


est store Models29


** Model 30 - Anaylsis of China Trade Share on US "important" votes (similarity with USA) (Yes/No/Abstain) **

xtreg prop_vote14 polity2 log_GDPpc tradeopen log_popn chn_tradeshare usa_tradeshare USAaid_GDP totnatresource_gdp yearsp* if Africa==1, fe vce(cluster count) 


est store Models30


estout Models25 Models26 Models27 Models28 Models29 Models30, cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  style(tex) legend label varlabels(_cons Constant) stats(N N_clust r2_a r2_o rmse, fmt(0 0 3 3 3) label(N NCountries AdjR2 OverallR2 RMSE)) starlevels(+ 0.10 ** 0.05 *** 0.001) modelwidth(4)




*** TABLE 6 (SUMMARY STATISTICS)

quietly xtreg wordscore_l_mv polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp  if Africa==1, fe vce(cluster count)

sutex2 wordscore_l_mv prop_vote3 prop_vote7 prop_vote2 prop_vote10 prop_vote14 polity2 log_GDPpc tradeopen log_popn  chn_tradeshare usa_tradeshare USAaid_GDP postcoldwar totnatresource_gdp conflict State_Dept  if e(sample)==1, minmax

 
